home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / game / shoot / ADoomPPC_src.lha / ADoomPPC_src / p_spec.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  9.5 KB  |  616 lines

  1. // Emacs style mode select   -*- C++ -*- 
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:  none
  18. //    Implements special effects:
  19. //    Texture animation, height or lighting changes
  20. //     according to adjacent sectors, respective
  21. //     utility functions, etc.
  22. //
  23. //-----------------------------------------------------------------------------
  24.  
  25.  
  26. #ifndef __P_SPEC__
  27. #define __P_SPEC__
  28.  
  29. #ifdef __SASC
  30. #pragma options align=mac68k
  31. #endif
  32.  
  33. //
  34. // End-level timer (-TIMER option)
  35. //
  36. extern    boolean levelTimer;
  37. extern    int    levelTimeCount;
  38.  
  39.  
  40. //      Define values for map objects
  41. #define MO_TELEPORTMAN          14
  42.  
  43.  
  44. // at game start
  45. void    P_InitPicAnims (void);
  46.  
  47. // at map load
  48. void    P_SpawnSpecials (void);
  49.  
  50. // every tic
  51. void    P_UpdateSpecials (void);
  52.  
  53. // when needed
  54. boolean
  55. P_UseSpecialLine
  56. ( mobj_t*    thing,
  57.   line_t*    line,
  58.   int        side );
  59.  
  60. void
  61. P_ShootSpecialLine
  62. ( mobj_t*    thing,
  63.   line_t*    line );
  64.  
  65. void
  66. P_CrossSpecialLine
  67. ( int        linenum,
  68.   int        side,
  69.   mobj_t*    thing );
  70.  
  71. void    P_PlayerInSpecialSector (player_t* player);
  72.  
  73. int
  74. twoSided
  75. ( int        sector,
  76.   int        line );
  77.  
  78. sector_t*
  79. getSector
  80. ( int        currentSector,
  81.   int        line,
  82.   int        side );
  83.  
  84. side_t*
  85. getSide
  86. ( int        currentSector,
  87.   int        line,
  88.   int        side );
  89.  
  90. fixed_t P_FindLowestFloorSurrounding(sector_t* sec);
  91. fixed_t P_FindHighestFloorSurrounding(sector_t* sec);
  92.  
  93. fixed_t
  94. P_FindNextHighestFloor
  95. ( sector_t*    sec,
  96.   int        currentheight );
  97.  
  98. fixed_t P_FindLowestCeilingSurrounding(sector_t* sec);
  99. fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);
  100.  
  101. int
  102. P_FindSectorFromLineTag
  103. ( line_t*    line,
  104.   int        start );
  105.  
  106. int
  107. P_FindMinSurroundingLight
  108. ( sector_t*    sector,
  109.   int        max );
  110.  
  111. sector_t*
  112. getNextSector
  113. ( line_t*    line,
  114.   sector_t*    sec );
  115.  
  116.  
  117. //
  118. // SPECIAL
  119. //
  120. int EV_DoDonut(line_t* line);
  121.  
  122.  
  123.  
  124. //
  125. // P_LIGHTS
  126. //
  127. typedef struct
  128. {
  129.     thinker_t     thinker;
  130.     sector_t  *    sector;
  131.     int         count;
  132.     int         maxlight;
  133.     int         minlight;
  134.     
  135. }  fireflicker_t;
  136.  
  137. typedef struct
  138. {
  139.     thinker_t     thinker;
  140.     sector_t  *    sector;
  141.     int         count;
  142.     int         maxlight;
  143.     int         minlight;
  144.     int         maxtime;
  145.     int         mintime;
  146.     
  147. }  lightflash_t;
  148.  
  149.  
  150. typedef struct
  151. {
  152.     thinker_t     thinker;
  153.     sector_t  *    sector;
  154.     int         count;
  155.     int         minlight;
  156.     int         maxlight;
  157.     int         darktime;
  158.     int         brighttime;
  159.     
  160. }  strobe_t;
  161.  
  162.  
  163. typedef struct
  164. {
  165.     thinker_t     thinker;
  166.     sector_t  *    sector;
  167.     int         minlight;
  168.     int         maxlight;
  169.     int         direction;
  170.  
  171. }  glow_t;
  172.  
  173.  
  174. #define GLOWSPEED            8
  175. #define STROBEBRIGHT        5
  176. #define FASTDARK            15
  177. #define SLOWDARK            35
  178.  
  179. void    P_SpawnFireFlicker (sector_t* sector);
  180. void    T_LightFlash (lightflash_t* flash);
  181. void    P_SpawnLightFlash (sector_t* sector);
  182. void    T_StrobeFlash (strobe_t* flash);
  183.  
  184. void
  185. P_SpawnStrobeFlash
  186. ( sector_t*    sector,
  187.   int        fastOrSlow,
  188.   int        inSync );
  189.  
  190. void    EV_StartLightStrobing(line_t* line);
  191. void    EV_TurnTagLightsOff(line_t* line);
  192.  
  193. void
  194. EV_LightTurnOn
  195. ( line_t*    line,
  196.   int        bright );
  197.  
  198. void    T_Glow(glow_t* g);
  199. void    P_SpawnGlowingLight(sector_t* sector);
  200.  
  201.  
  202.  
  203.  
  204. //
  205. // P_SWITCH
  206. //
  207. typedef struct
  208. {
  209.     char     name1[9];
  210.     char     name2[9];
  211.     short     episode;
  212. }  switchlist_t;
  213.  
  214. typedef enum
  215. {
  216.     top,
  217.     middle,
  218.     bottom
  219. }  bwhere_e;
  220.  
  221. typedef struct
  222. {
  223.     line_t  *    line;
  224.     bwhere_e     where;
  225.     int         btexture;
  226.     int         btimer;
  227.     mobj_t  *    soundorg;
  228.  
  229. }  button_t;
  230.  
  231.  
  232.  
  233.  // max # of wall switches in a level
  234. #define MAXSWITCHES        50
  235.  
  236.  // 4 players, 4 buttons each at once, max.
  237. #define MAXBUTTONS        16
  238.  
  239.  // 1 second, in ticks. 
  240. #define BUTTONTIME      35             
  241.  
  242. extern button_t    buttonlist[MAXBUTTONS]; 
  243.  
  244. void
  245. P_ChangeSwitchTexture
  246. ( line_t*    line,
  247.   int        useAgain );
  248.  
  249. void P_InitSwitchList(void);
  250.  
  251.  
  252. //
  253. // P_PLATS
  254. //
  255. typedef enum
  256. {
  257.     up,
  258.     down,
  259.     waiting,
  260.     in_stasis
  261. }  plat_e;
  262.  
  263.  
  264. typedef enum
  265. {
  266.     perpetualRaise,
  267.     downWaitUpStay,
  268.     raiseAndChange,
  269.     raiseToNearestAndChange,
  270.     blazeDWUS
  271. }  plattype_e;
  272.  
  273. typedef struct
  274. {
  275.     thinker_t     thinker;
  276.     sector_t  *    sector;
  277.     fixed_t     speed;
  278.     fixed_t     low;
  279.     fixed_t     high;
  280.     int         wait;
  281.     int         count;
  282.     plat_e     status;
  283.     plat_e     oldstatus;
  284.     boolean     crush;
  285.     int         tag;
  286.     plattype_e     type;
  287. }  plat_t;
  288.  
  289.  
  290. #define PLATWAIT        3
  291. #define PLATSPEED        FRACUNIT
  292. #define MAXPLATS        30
  293.  
  294.  
  295. extern plat_t*    activeplats[MAXPLATS];
  296.  
  297. void    T_PlatRaise(plat_t*    plat);
  298.  
  299. int
  300. EV_DoPlat
  301. ( line_t*    line,
  302.   plattype_e    type,
  303.   int        amount );
  304.  
  305. void    P_AddActivePlat(plat_t* plat);
  306. void    P_RemoveActivePlat(plat_t* plat);
  307. void    EV_StopPlat(line_t* line);
  308. void    P_ActivateInStasis(int tag);
  309.  
  310.  
  311. //
  312. // P_DOORS
  313. //
  314. typedef enum
  315. {
  316.     normal,
  317.     close30ThenOpen,
  318.     close,
  319.     open,
  320.     raiseIn5Mins,
  321.     blazeRaise,
  322.     blazeOpen,
  323.     blazeClose
  324. }  vldoor_e;
  325.  
  326. typedef struct
  327. {
  328.     thinker_t     thinker;
  329.     vldoor_e     type;
  330.     sector_t  *    sector;
  331.     fixed_t     topheight;
  332.     fixed_t     speed;
  333.  
  334.     // 1 = up, 0 = waiting at top, -1 = down
  335.     int              direction;
  336.     
  337.     // tics to wait at the top
  338.     int              topwait;
  339.     // (keep in case a door going down is reset)
  340.     // when it reaches 0, start going down
  341.     int              topcountdown;
  342. }  vldoor_t;
  343.  
  344. #define VDOORSPEED        FRACUNIT*2
  345. #define VDOORWAIT        150
  346.  
  347. void
  348. EV_VerticalDoor
  349. ( line_t*    line,
  350.   mobj_t*    thing );
  351.  
  352. int
  353. EV_DoDoor
  354. ( line_t*    line,
  355.   vldoor_e    type );
  356.  
  357. int
  358. EV_DoLockedDoor
  359. ( line_t*    line,
  360.   vldoor_e    type,
  361.   mobj_t*    thing );
  362.  
  363. void    T_VerticalDoor (vldoor_t* door);
  364. void    P_SpawnDoorCloseIn30 (sector_t* sec);
  365.  
  366. void
  367. P_SpawnDoorRaiseIn5Mins
  368. ( sector_t*    sec,
  369.   int        secnum );
  370.  
  371.  
  372.  
  373. #if 0 // UNUSED
  374. //
  375. //      Sliding doors...
  376. //
  377. typedef enum
  378. {
  379.     sd_opening,
  380.     sd_waiting,
  381.     sd_closing
  382.  
  383. } sd_e;
  384.  
  385.  
  386.  
  387. typedef enum
  388. {
  389.     sdt_openOnly,
  390.     sdt_closeOnly,
  391.     sdt_openAndClose
  392.  
  393. } sdt_e;
  394.  
  395.  
  396.  
  397.  
  398. typedef struct
  399. {
  400.     thinker_t    thinker;
  401.     sdt_e    type;
  402.     line_t*    line;
  403.     int        frame;
  404.     int        whichDoorIndex;
  405.     int        timer;
  406.     sector_t*    frontsector;
  407.     sector_t*    backsector;
  408.     sd_e     status;
  409.  
  410. } slidedoor_t;
  411.  
  412.  
  413.  
  414. typedef struct
  415. {
  416.     char    frontFrame1[9];
  417.     char    frontFrame2[9];
  418.     char    frontFrame3[9];
  419.     char    frontFrame4[9];
  420.     char    backFrame1[9];
  421.     char    backFrame2[9];
  422.     char    backFrame3[9];
  423.     char    backFrame4[9];
  424.     
  425. } slidename_t;
  426.  
  427.  
  428.  
  429. typedef struct
  430. {
  431.     int             frontFrames[4];
  432.     int             backFrames[4];
  433.  
  434. } slideframe_t;
  435.  
  436.  
  437.  
  438. // how many frames of animation
  439. #define SNUMFRAMES        4
  440.  
  441. #define SDOORWAIT        35*3
  442. #define SWAITTICS        4
  443.  
  444. // how many diff. types of anims
  445. #define MAXSLIDEDOORS    5                            
  446.  
  447. void P_InitSlidingDoorFrames(void);
  448.  
  449. void
  450. EV_SlidingDoor
  451. ( line_t*    line,
  452.   mobj_t*    thing );
  453. #endif
  454.  
  455.  
  456.  
  457. //
  458. // P_CEILNG
  459. //
  460. typedef enum
  461. {
  462.     lowerToFloor,
  463.     raiseToHighest,
  464.     lowerAndCrush,
  465.     crushAndRaise,
  466.     fastCrushAndRaise,
  467.     silentCrushAndRaise
  468. }  ceiling_e;
  469.  
  470. typedef struct
  471. {
  472.     thinker_t     thinker;
  473.     ceiling_e     type;
  474.     sector_t  *    sector;
  475.     fixed_t     bottomheight;
  476.     fixed_t     topheight;
  477.     fixed_t     speed;
  478.     boolean     crush;
  479.  
  480.     // 1 = up, 0 = waiting, -1 = down
  481.     int         direction;
  482.  
  483.     // ID
  484.     int         tag;                   
  485.     int         olddirection;
  486. }  ceiling_t;
  487.  
  488.  
  489.  
  490.  
  491. #define CEILSPEED        FRACUNIT
  492. #define CEILWAIT        150
  493. #define MAXCEILINGS        30
  494.  
  495. extern ceiling_t*    activeceilings[MAXCEILINGS];
  496.  
  497. int
  498. EV_DoCeiling
  499. ( line_t*    line,
  500.   ceiling_e    type );
  501.  
  502. void    T_MoveCeiling (ceiling_t* ceiling);
  503. void    P_AddActiveCeiling(ceiling_t* c);
  504. void    P_RemoveActiveCeiling(ceiling_t* c);
  505. int    EV_CeilingCrushStop(line_t* line);
  506. void    P_ActivateInStasisCeiling(line_t* line);
  507.  
  508.  
  509. //
  510. // P_FLOOR
  511. //
  512. typedef enum
  513. {
  514.     // lower floor to highest surrounding floor
  515.     lowerFloor,
  516.     
  517.     // lower floor to lowest surrounding floor
  518.     lowerFloorToLowest,
  519.     
  520.     // lower floor to highest surrounding floor VERY FAST
  521.     turboLower,
  522.     
  523.     // raise floor to lowest surrounding CEILING
  524.     raiseFloor,
  525.     
  526.     // raise floor to next highest surrounding floor
  527.     raiseFloorToNearest,
  528.  
  529.     // raise floor to shortest height texture around it
  530.     raiseToTexture,
  531.     
  532.     // lower floor to lowest surrounding floor
  533.     //  and change floorpic
  534.     lowerAndChange,
  535.   
  536.     raiseFloor24,
  537.     raiseFloor24AndChange,
  538.     raiseFloorCrush,
  539.  
  540.      // raise to next highest floor, turbo-speed
  541.     raiseFloorTurbo,       
  542.     donutRaise,
  543.     raiseFloor512
  544. }  floor_e;
  545.  
  546.  
  547. typedef enum
  548. {
  549.     build8,    // slowly build by 8
  550.     turbo16    // quickly build by 16
  551. }  stair_e;
  552.  
  553. typedef struct
  554. {
  555.     thinker_t     thinker;
  556.     floor_e     type;
  557.     boolean     crush;
  558.     sector_t  *    sector;
  559.     int         direction;
  560.     int         newspecial;
  561.     short     texture;
  562.     fixed_t     floordestheight;
  563.     fixed_t     speed;
  564. }  floormove_t;
  565.  
  566.  
  567. #define FLOORSPEED        FRACUNIT
  568.  
  569. typedef enum
  570. {
  571.     ok,
  572.     crushed,
  573.     pastdest
  574. }  result_e;
  575.  
  576. result_e
  577. T_MovePlane
  578. ( sector_t*    sector,
  579.   fixed_t    speed,
  580.   fixed_t    dest,
  581.   boolean    crush,
  582.   int        floorOrCeiling,
  583.   int        direction );
  584.  
  585. int
  586. EV_BuildStairs
  587. ( line_t*    line,
  588.   stair_e    type );
  589.  
  590. int
  591. EV_DoFloor
  592. ( line_t*    line,
  593.   floor_e    floortype );
  594.  
  595. void T_MoveFloor( floormove_t* floor);
  596.  
  597. //
  598. // P_TELEPT
  599. //
  600. int
  601. EV_Teleport
  602. ( line_t*    line,
  603.   int        side,
  604.   mobj_t*    thing );
  605.  
  606. #ifdef __SASC
  607. #pragma options align=power
  608. #endif
  609.  
  610. #endif
  611. //-----------------------------------------------------------------------------
  612. //
  613. // $Log:$
  614. //
  615. //-----------------------------------------------------------------------------
  616.